< previous page page_485 next page >

Page 485
9f31265bb40b592b1929e18a47ab28e5.gif
adLockOptimistic. This is the most common type of locking employed by database management systems. When this type of locking is set, the data source only locks a record when an Update method is performed on an ADO recordset. Then the data is written, the lock is released. This results in a lot less time spent with locks on the data.
9f31265bb40b592b1929e18a47ab28e5.gif
adLockBatchOptimistic. This is used for batch optimistic cursors, typically associated with remote data. This will not be covered in this book.
Options is a constant that determines how the provider should evaluate the Source argument if its something other than a Command object. The following are some of the definitions of these options:
9f31265bb40b592b1929e18a47ab28e5.gif
adCmdText. The Source property is a SQL statement.
9f31265bb40b592b1929e18a47ab28e5.gif
adCmdTable and adCmdTableDirect. The Source property is a table name.
9f31265bb40b592b1929e18a47ab28e5.gif
adCmdStoredProc. The Source property is a stored procedure name.
9f31265bb40b592b1929e18a47ab28e5.gif
adCmdUnknown. The Source property is an unknown type. In this case, the driver figures out the type and performs the appropriate action. Of course, this takes longer, so you should avoid this option.
Opening a Forward-Only Recordset
You can use several methods to create a recordset that reads data. Youll see a couple of examples of how to do this in this chapter. Lets look at some code that shows how to open different types of recordsets with different options.
Examples Filename: Recordsets.frm
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdForward_Click()
   Dim oRS As Recordset
   Dim strSQL As String

   strSQL = "SELECT "
   strSQL = strSQL & "szLast_nm, "
   strSQL = strSQL & "sFirst_nm "
   strSQL = strSQL & "FROM tblEmployees "

   Set oRS = New Recordset

 
< previous page page_485 next page >

If you like this book, buy it!